// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

// ReSharper disable CheckNamespace
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable CommentTypo
// ReSharper disable IdentifierTypo
// ReSharper disable InconsistentNaming
// ReSharper disable StringLiteralTypo
// ReSharper disable UnusedParameter.Local

/*
 * Ars Magna project, http://arsmagna.ru
 */

#region Using directives

using System;

#endregion

#nullable enable

namespace AM.Reporting.Barcode.QRCode
{
/*  /// <summary> A class which wraps a 2D array of bytes. The default usage is signed. If you want to use it as a
  /// unsigned container, it's up to you to do byteValue &amp; 0xff at each location.
  ///
  /// JAVAPORT: The original code was a 2D array of ints, but since it only ever gets assigned
  /// -1, 0, and 1, I'm going to use less memory and go with bytes.
  ///
  /// </summary>
  /// <author>  dswitkin@google.com (Daniel Switkin)
  /// </author>
  /// <author>www.Redivivus.in (suraj.supekar@redivivus.in) - Ported from ZXING Java Source
  /// </author>*/
    internal sealed class ByteMatrix
    {
        public int Height { get; }

        public int Width { get; }

        public sbyte[][] Array { get; }

        //UPGRADE_NOTE: Final was removed from the declaration of 'bytes '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"

        //UPGRADE_NOTE: Final was removed from the declaration of 'width '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"

        //UPGRADE_NOTE: Final was removed from the declaration of 'height '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"

        public ByteMatrix (int width, int height)
        {
            Array = new sbyte[height][];
            for (var i = 0; i < height; i++)
            {
                Array[i] = new sbyte[width];
            }

            this.Width = width;
            this.Height = height;
        }

        public sbyte get_Renamed (int x, int y)
        {
            return Array[y][x];
        }

        public void set_Renamed (int x, int y, sbyte value_Renamed)
        {
            Array[y][x] = value_Renamed;
        }

        public void set_Renamed (int x, int y, int value_Renamed)
        {
            Array[y][x] = (sbyte)value_Renamed;
        }

        public void clear (sbyte value_Renamed)
        {
            for (var y = 0; y < Height; ++y)
            {
                for (var x = 0; x < Width; ++x)
                {
                    Array[y][x] = value_Renamed;
                }
            }
        }
    }
}
